----------------------------------------------------------------------------------------------------------------------------
       log:  Z:\interactionmodels\results\fragmentationfig_FIG1.log
  log type:  text
 opened on:  11 Jan 2007, 16:00:10

. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      fragmentationfig_FIG1.do                        *;
. *       Date:           1/11/07                                         *;
. *       Author:         MRG                                             *;
. *       Purpose:        Creates fragmentation figure 1 (left)           *;
. *       Input File:     STATA_mozaffar.dta, golder1.dta                 *;
. *       Output File:    fragmentationfig_FIG1.log                       *;
. *       Data Output:    none                                            *;
. *       Previous file:                                                  *;
. *       Machine:                                                        *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. set mem 10m;
(10240k)

. use getdata\STATA_mozaffar.dta;

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *               Fragmentation Figure for Legislative Parties            *;
. *               MSG data, FIGURE 1 (left) in paper                      *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. regress legparties  fragmentation concentration logmag10 frag_conc logmag10_frag  
> logmag10_conc logmag10_frag_conc proximity prescandidate prox_prescandidate, robust;

Regression with robust standard errors                 Number of obs =      62
                                                       F( 10,    51) =   18.12
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.7566
                                                       Root MSE      =  .81255

------------------------------------------------------------------------------
             |               Robust
  legparties |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
fragmentat~n |  -.3061517   .1244102    -2.46   0.017    -.5559156   -.0563877
concentrat~n |   .1077863   .2720849     0.40   0.694    -.4384468    .6540195
    logmag10 |   .6576745   .4536982     1.45   0.153    -.2531626    1.568512
   frag_conc |   .1468926   .0486345     3.02   0.004     .0492546    .2445305
logmag10_f~g |   -.072974   .1039821    -0.70   0.486    -.2817268    .1357788
logmag10_c~c |  -.8640806   .3508728    -2.46   0.017    -1.568487    -.159674
~0_frag_conc |     .17936   .0804572     2.23   0.030     .0178355    .3408846
   proximity |  -.5792874   .4341616    -1.33   0.188    -1.450903    .2923284
prescandid~e |   .4972876   .1789268     2.78   0.008      .138077    .8564981
prox_presc~e |   .0357922   .2703231     0.13   0.895     -.506904    .5784883
       _cons |   1.274294   .3003618     4.24   0.000     .6712925    1.877295
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Create x-axis for modifying variable (LOGMAG10) = JH            *;
. *     ****************************************************************  *;
. generate JH=((_n-1)/10);

.     replace JH=. if _n>30;
(32 real changes made, 32 to missing)

. generate str1 txt="*";

. *     ****************************************************************  *;
. *       Grab elements of the matrix required for calculating            *;
. *       conditional coefficients and standard errors.                   *;
. *     ****************************************************************  *;
. matrix b=e(b);

. matrix V=e(V);

. scalar b1=b[1,1];

. scalar b2=b[1,2];

. scalar b3=b[1,3];

. scalar b4=b[1,4];

. scalar b5=b[1,5];

. scalar b6=b[1,6];

. scalar b7=b[1,7];

. scalar varb1=V[1,1];

. scalar varb2=V[2,2];

. scalar varb3=V[3,3];

. scalar varb4=V[4,4];

. scalar varb5=V[5,5];

. scalar varb6=V[6,6];

. scalar varb7=V[7,7];

. scalar covb1b4=V[1,4];

. scalar covb1b5=V[1,5];

. scalar covb1b7=V[1,7];

. scalar covb4b5=V[4,5];

. scalar covb4b7=V[4,7];

. scalar covb5b7=V[5,7];

. set more off;

. scalar list b1 b2 b3 b4 b5 b6 b7 varb1 varb2 varb3 varb4 varb5 varb6 varb7 
>             covb1b4 covb1b5 covb1b7 covb4b5 covb4b7 covb5b7;
        b1 = -.30615166
        b2 =  .10778635
        b3 =  .65767451
        b4 =  .14689255
        b5 =   -.072974
        b6 = -.86408064
        b7 =  .17936003
     varb1 =  .01547791
     varb2 =  .07403019
     varb3 =  .20584204
     varb4 =  .00236532
     varb5 =  .01081228
     varb6 =  .12311175
     varb7 =  .00647336
   covb1b4 = -.00416635
   covb1b5 = -.00751984
   covb1b7 =  .00293553
   covb4b5 =  .00356405
   covb4b7 =   -.002505
   covb5b7 = -.00740659

. *     ****************************************************************  *;
. *         Create full range of conditional coefficients for             *;
. *       fragmentation                                                   *;
. *     ****************************************************************  *;
. gen conb0=b1+b4*0+b5*JH+b7*(0*JH) if _n<30;
(33 missing values generated)

. gen conb1=b1+b4*1+b5*JH+b7*(1*JH) if _n<30;
(33 missing values generated)

. gen conb2=b1+b4*2+b5*JH+b7*(2*JH) if _n<30;
(33 missing values generated)

. gen conb3=b1+b4*3+b5*JH+b7*(3*JH) if _n<30;
(33 missing values generated)

. gen conb4=b1+b4*4+b5*JH+b7*(4*JH) if _n<30;
(33 missing values generated)

. set more off;

. *     ****************************************************************  *;
. *           Create full range of conditional standard errors            *;
. *     ****************************************************************  *;
. gen conse0=sqrt(varb1
>                 + varb4*(0^2) + varb5*JH^2 + varb7*JH^2*(0^2)
>                 + 2*0*covb1b4 + 2*JH*covb1b5 + 2*0*JH*covb1b7+2*0*JH*covb4b5
>                 + 2*(0^2)*JH*covb4b7 + 2*0*(JH^2)*covb5b7)  if _n<30;
(33 missing values generated)

.                 gen conse1=sqrt(varb1
>                 + varb4*(1^2) + varb5*JH^2 + varb7*JH^2*(1^2)
>                 + 2*1*covb1b4 + 2*JH*covb1b5 + 2*1*JH*covb1b7+2*1*JH*covb4b5
>                 + 2*(1^2)*JH*covb4b7 + 2*1*(JH^2)*covb5b7)  if _n<30;
(33 missing values generated)

.                 gen conse2=sqrt(varb1
>                 + varb4*(2^2) + varb5*JH^2 + varb7*JH^2*(2^2)
>                 + 2*2*covb1b4 + 2*JH*covb1b5 + 2*2*JH*covb1b7+2*2*JH*covb4b5
>                 + 2*(2^2)*JH*covb4b7 + 2*2*(JH^2)*covb5b7)  if _n<30;
(33 missing values generated)

.                 gen conse3=sqrt(varb1
>                 + varb4*(3^2) + varb5*JH^2 + varb7*JH^2*(3^2)
>                 + 2*3*covb1b4 + 2*JH*covb1b5 + 2*3*JH*covb1b7+2*3*JH*covb4b5
>                 + 2*(3^2)*JH*covb4b7 + 2*3*(JH^2)*covb5b7)  if _n<30;
(33 missing values generated)

.                 gen conse4=sqrt(varb1
>                 + varb4*(4^2) + varb5*JH^2 + varb7*JH^2*(4^2)
>                 + 2*4*covb1b4 + 2*JH*covb1b5 + 2*4*JH*covb1b7+2*4*JH*covb4b5
>                 + 2*(4^2)*JH*covb4b7 + 2*4*(JH^2)*covb5b7)  if _n<30;
(33 missing values generated)

.                 set more off;

. *     ****************************************************************  *;
. *                           Create t statistics                         *;
. *     ****************************************************************  *;
. gen t0=conb0/conse0;
(33 missing values generated)

. gen t1=conb1/conse1;
(33 missing values generated)

. gen t2=conb2/conse2;
(33 missing values generated)

. gen t3=conb3/conse3;
(33 missing values generated)

. gen t4=conb4/conse4;
(33 missing values generated)

. *     ****************************************************************  *;
. *       Generate a variable equal to conditional betas                  *;
. *     ****************************************************************  *;
. gen consb0=conb0;
(33 missing values generated)

. gen consb1=conb1;
(33 missing values generated)

. gen consb2=conb2;
(33 missing values generated)

. gen consb3=conb3;
(33 missing values generated)

. gen consb4=conb4;
(33 missing values generated)

. *     ****************************************************************  *;
. *       Replace consb_ = missing if t score not bigger than cutoff      *;
. *     ****************************************************************  *;
. replace consb0 = . if abs(t0)<2.01;
(0 real changes made)

. replace consb1 = . if abs(t1)<2.01;
(29 real changes made, 29 to missing)

. replace consb2 = . if abs(t2)<2.01;
(6 real changes made, 6 to missing)

. replace consb3 = . if abs(t3)<2.01;
(2 real changes made, 2 to missing)

. replace consb4 = . if abs(t4)<2.01;
(1 real change made, 1 to missing)

. set textsize 100;

. *     ****************************************************************  *;
. *       Graph the effect of fragmentation on legislative parties        *;
. *       conditional on logmag                                           *;
. *     ****************************************************************  *;
. graph twoway   line conb0 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb0 JH ,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb1 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb1 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb2 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb2 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb3 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb3 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)        
>         ||  ,   
>             ysize(6)
>             xsize(8)
>             xlabel(0 1 2 3, labsize(2.5)) 
>             ylabel(-1 0 1 2, labsize(2.5))
>             yscale(noline)
>             xscale(noline)
>             legend(off)
>             yline(0, lcolor(black)) yline(-1 1 2 3, lcolor(white)) 
>             xtitle("")
>             ytitle("")
>         xsca(titlegap(2)) ysca(titlegap(4))
>         text(2 1 "* indicates significance at the 95% level", justification(left) size(2.5))
>         scheme(s2mono) graphregion(fcolor(white))
>         graphregion(margin(r=28));

.         set textsize 100;

. drop JH conb0 conb1 conb2 conb3 conb4 consb0 consb1 consb2 consb3 consb4 conse0 conse1 conse2 conse3 conse4 t0 t1 t2 t3 t4
>  txt;

. *     ****************************************************************  *;
. *                               Save Graph                              *;
. *     ****************************************************************  *;
. translate @Graph results\FIG1_LEFT_fragmentation_leg.wmf, replace;
(file Z:\interactionmodels\results\FIG1_LEFT_fragmentation_leg.wmf written in Windows Metafile format)

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *               Fragmentation Figure for Legislative Parties            *;
. *               Golder data, FIGURE 1 (right) in paper                  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. clear;

. use getdata\golder1.dta;

. *     ****************************************************************  *;
. *                   Now do recode of concentration                      *;
. *     ****************************************************************  *;
. gen conc1 = concentration;
(38 missing values generated)

. replace conc1 = 3 if (fragmentation==1 & concentration==0);
(11 real changes made)

. gen frag_conc1 = fragmentation*conc1;
(38 missing values generated)

. gen logmag_conc1_nyu = logmag_nyu*conc1;
(38 missing values generated)

. gen frag_conc1_logmag_nyu = fragmentation*conc1*logmag_nyu;
(38 missing values generated)

. regress legparties_nyu  fragmentation conc1 logmag_nyu 
>         frag_conc_nyu logmag_frag_nyu logmag_conc1_nyu 
>         frag_conc1_logmag_nyu proximity_nyu prescandidate_nyu 
>         prox_prescandidate_nyu, robust;

Regression with robust standard errors                 Number of obs =      62
                                                       F( 10,    51) =   16.75
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.7306
                                                       Root MSE      =  1.0854

------------------------------------------------------------------------------
             |               Robust
legparties~u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
fragmentat~n |  -.0276001   .2143886    -0.13   0.898    -.4580031    .4028029
       conc1 |   .2883743   .2938377     0.98   0.331    -.3015296    .8782781
  logmag_nyu |   .2257781    .470203     0.48   0.633    -.7181939     1.16975
frag_conc_~u |   .0119348   .0722382     0.17   0.869    -.1330894    .1569589
logmag~g_nyu |  -.0693118   .0834624    -0.83   0.410    -.2368696    .0982459
logmag~1_nyu |  -.3208977    .203715    -1.58   0.121    -.7298727    .0880772
frag_conc1~u |   .1109566   .0434501     2.55   0.014      .023727    .1981863
proximity_~u |   -.620879   .5784712    -1.07   0.288    -1.782208    .5404504
prescandid~u |   1.244473   .3985811     3.12   0.003     .4442876    2.044657
prox_presc~u |  -.4968175   .3708312    -1.34   0.186    -1.241292    .2476572
       _cons |   .3083625    1.10611     0.28   0.782    -1.912247    2.528972
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Create x-axis for modifying variable (LOGMAG10) = JH            *;
. *     ****************************************************************  *;
. generate JH=((_n-1)/10);

.     replace JH=. if _n>30;
(70 real changes made, 70 to missing)

. generate str1 txt="*";

. *     ****************************************************************  *;
. *       Grab elements of the matrix required for calculating            *;
. *       conditional coefficients and standard errors.                   *;
. *     ****************************************************************  *;
. matrix b=e(b);

. matrix V=e(V);

. scalar b1=b[1,1];

. scalar b2=b[1,2];

. scalar b3=b[1,3];

. scalar b4=b[1,4];

. scalar b5=b[1,5];

. scalar b6=b[1,6];

. scalar b7=b[1,7];

. scalar varb1=V[1,1];

. scalar varb2=V[2,2];

. scalar varb3=V[3,3];

. scalar varb4=V[4,4];

. scalar varb5=V[5,5];

. scalar varb6=V[6,6];

. scalar varb7=V[7,7];

. scalar covb1b4=V[1,4];

. scalar covb1b5=V[1,5];

. scalar covb1b7=V[1,7];

. scalar covb4b5=V[4,5];

. scalar covb4b7=V[4,7];

. scalar covb5b7=V[5,7];

. set more off;

. scalar list b1 b2 b3 b4 b5 b6 b7 varb1 varb2 varb3 varb4 varb5 varb6 varb7 
>             covb1b4 covb1b5 covb1b7 covb4b5 covb4b7 covb5b7;
        b1 = -.02760008
        b2 =  .28837428
        b3 =   .2257781
        b4 =  .01193475
        b5 = -.06931184
        b6 = -.32089774
        b7 =  .11095662
     varb1 =  .04596246
     varb2 =  .08634061
     varb3 =  .22109089
     varb4 =  .00521835
     varb5 =  .00696597
     varb6 =  .04149981
     varb7 =  .00188791
   covb1b4 =  -.0140123
   covb1b5 = -.01576001
   covb1b7 =  .00584164
   covb4b5 =  .00470582
   covb4b7 = -.00233714
   covb5b7 = -.00294168

. *     ****************************************************************  *;
. *         Create full range of conditional coefficients for             *;
. *       fragmentation                                                   *;
. *     ****************************************************************  *;
. gen conb0=b1+b4*0+b5*JH+b7*(0*JH) if _n<30;
(71 missing values generated)

. gen conb1=b1+b4*1+b5*JH+b7*(1*JH) if _n<30;
(71 missing values generated)

. gen conb2=b1+b4*2+b5*JH+b7*(2*JH) if _n<30;
(71 missing values generated)

. gen conb3=b1+b4*3+b5*JH+b7*(3*JH) if _n<30;
(71 missing values generated)

. gen conb4=b1+b4*4+b5*JH+b7*(4*JH) if _n<30;
(71 missing values generated)

. set more off;

. *     ****************************************************************  *;
. *           Create full range of conditional standard errors            *;
. *     ****************************************************************  *;
. gen conse0=sqrt(varb1
>                 + varb4*(0^2) + varb5*JH^2 + varb7*JH^2*(0^2)
>                 + 2*0*covb1b4 + 2*JH*covb1b5 + 2*0*JH*covb1b7+2*0*JH*covb4b5
>                 + 2*(0^2)*JH*covb4b7 + 2*0*(JH^2)*covb5b7)  if _n<30;
(71 missing values generated)

.                 gen conse1=sqrt(varb1
>                 + varb4*(1^2) + varb5*JH^2 + varb7*JH^2*(1^2)
>                 + 2*1*covb1b4 + 2*JH*covb1b5 + 2*1*JH*covb1b7+2*1*JH*covb4b5
>                 + 2*(1^2)*JH*covb4b7 + 2*1*(JH^2)*covb5b7)  if _n<30;
(71 missing values generated)

.                 gen conse2=sqrt(varb1
>                 + varb4*(2^2) + varb5*JH^2 + varb7*JH^2*(2^2)
>                 + 2*2*covb1b4 + 2*JH*covb1b5 + 2*2*JH*covb1b7+2*2*JH*covb4b5
>                 + 2*(2^2)*JH*covb4b7 + 2*2*(JH^2)*covb5b7)  if _n<30;
(71 missing values generated)

.                 gen conse3=sqrt(varb1
>                 + varb4*(3^2) + varb5*JH^2 + varb7*JH^2*(3^2)
>                 + 2*3*covb1b4 + 2*JH*covb1b5 + 2*3*JH*covb1b7+2*3*JH*covb4b5
>                 + 2*(3^2)*JH*covb4b7 + 2*3*(JH^2)*covb5b7)  if _n<30;
(71 missing values generated)

.                 gen conse4=sqrt(varb1
>                 + varb4*(4^2) + varb5*JH^2 + varb7*JH^2*(4^2)
>                 + 2*4*covb1b4 + 2*JH*covb1b5 + 2*4*JH*covb1b7+2*4*JH*covb4b5
>                 + 2*(4^2)*JH*covb4b7 + 2*4*(JH^2)*covb5b7)  if _n<30;
(71 missing values generated)

.                 set more off;

. *     ****************************************************************  *;
. *                           Create t statistics                         *;
. *     ****************************************************************  *;
. gen t0=conb0/conse0;
(71 missing values generated)

. gen t1=conb1/conse1;
(71 missing values generated)

. gen t2=conb2/conse2;
(71 missing values generated)

. gen t3=conb3/conse3;
(71 missing values generated)

. gen t4=conb4/conse4;
(71 missing values generated)

. *     ****************************************************************  *;
. *       Generate a variable equal to conditional betas                  *;
. *     ****************************************************************  *;
. gen consb0=conb0;
(71 missing values generated)

. gen consb1=conb1;
(71 missing values generated)

. gen consb2=conb2;
(71 missing values generated)

. gen consb3=conb3;
(71 missing values generated)

. gen consb4=conb4;
(71 missing values generated)

. *     ****************************************************************  *;
. *       Replace consb_ = missing if t score not bigger than cutoff      *;
. *     ****************************************************************  *;
. replace consb0 = . if abs(t0)<2.01;
(29 real changes made, 29 to missing)

. replace consb1 = . if abs(t1)<2.01;
(29 real changes made, 29 to missing)

. replace consb2 = . if abs(t2)<2.01;
(11 real changes made, 11 to missing)

. replace consb3 = . if abs(t3)<2.01;
(6 real changes made, 6 to missing)

. replace consb4 = . if abs(t4)<2.01;
(5 real changes made, 5 to missing)

. set textsize 100;

. *     ****************************************************************  *;
. *       Graph the effect of fragmentation on legislative parties        *;
. *       conditional on logmag                                           *;
. *     ****************************************************************  *;
. graph twoway   line conb0 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb0 JH ,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb1 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb1 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb2 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb2 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)
>         ||  line conb3 JH , clpattern(solid) clwidth(thin)
>         ||  scatter consb3 JH,  mlabel(txt) msymbol(i) mlabsize(vsmall) mlabgap(-1.0) mlabposition(11)        
>         ||  ,   
>             ysize(6)
>             xsize(8)
>             xlabel(0 1 2 3, labsize(2.5)) 
>             ylabel(-0.5 0 0.5 1 , labsize(2.5))
>             yscale(noline)
>             xscale(noline)
>             legend(off)
>             yline(0, lcolor(black)) yline(-0.5  0.5 1, lcolor(white)) 
>             xtitle("")
>             ytitle("")
>         xsca(titlegap(2)) ysca(titlegap(4))
>         scheme(s2mono) 
>         graphregion(fcolor(white))
>         graphregion(margin(r=28));

.                *     ****************************************************************  *;
. *                               Save graph                              *;
. *     ****************************************************************  *;
. translate @Graph results\FIG1_RIGHT_fragmentation_leg.wmf, replace;
(file Z:\interactionmodels\results\FIG1_RIGHT_fragmentation_leg.wmf written in Windows Metafile format)

. drop JH conb0 conb1 conb2 conb3 conb4 consb0 consb1 consb2 consb3 consb4 conse0 conse1 conse2 conse3 conse4 t0 t1 t2 t3 t4
>  txt;

. *     ****************************************************************  *;
. *                           Replication complete                        *;
. *     ****************************************************************  *;
.                     log close;
       log:  Z:\interactionmodels\results\fragmentationfig_FIG1.log
  log type:  text
 closed on:  11 Jan 2007, 16:00:20
----------------------------------------------------------------------------------------------------------------------------
